#ifndef IFDINTERFACE_H
#define IFDINTERFACE_H
#define PACKED
struct INFORMATION
{
	unsigned int size;
	unsigned short date;
	unsigned short time;
	unsigned char attribute;
	char name[8+1+3+1];    /* Name (8.3 format) */
	
} PACKED ;
typedef struct INFORMATION	_info;

namespace IFDInterface
{
typedef enum {
    FR_OK = 0,            /* 0 */
    FR_NOT_READY,        /* 1 */
    FR_NO_FILE,            /* 2 */
    FR_NO_PATH,            /* 3 */
    FR_INVALID_NAME,    /* 4 */
    FR_INVALID_DRIVE,    /* 5 */
    FR_DENIED,            /* 6 */
    FR_EXIST,            /* 7 */
    FR_RW_ERROR,        /* 8 */
    FR_WRITE_PROTECTED,    /* 9 */
    FR_NOT_ENABLED,        /* 10 */
    FR_NO_FILESYSTEM,    /* 11 */
    FR_INVALID_OBJECT,    /* 12 */
    FR_MKFS_ABORTED,        /* 13 */
    FR_SYS_SYNC_FAILED	   /* 14 */
}PACKED FRESULT;

typedef struct
{
FRESULT (*file_state)	(const char* path,_info* fileinfo);
FRESULT (*file_read)	(void** obj,char* buff,unsigned int size,unsigned int offset);
FRESULT (*file_write)	(void** obj,const char* buff,unsigned int size,unsigned int offset);
FRESULT (*file_open)	(void** obj,const char* path,unsigned int mode);				//Drive_init			
FRESULT (*file_sync)	(void** obj);
FRESULT (*file_close)	(void** obj);									//Drive_uninit	
FRESULT (*file_ioctl)	(void** obj,unsigned char code,void* buff);					
FRESULT (*file_lseek)	(void** obj,unsigned int offset);
FRESULT (*file_unlink)	(const char* path);
FRESULT (*file_rename)	(const char* path, const char* newname);
FRESULT (*file_opendir)	(void** obj, const char* path);
FRESULT (*file_readdir)	(void** obj,_info* fileinfo);
FRESULT (*file_mkdir)	(const char* path);
FRESULT (*file_mkfs)	(const char* path,unsigned int rule_alloc);	//rule & allocation
FRESULT (*file_mount)	(void** obj);					//when mounted/init , what to do
}_file_op;

}
#endif
